import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

//状态对象
var state = {
  name:''
}

var mutations = {
  tianjia(state,n){
    state.name = n;
  }
}

//改变状态对象的方法mutations
var actions = {
  tianjia({commit},n){
    commit('tianjia',n)
  }
}

//默认情况
const getters = {
  spm: state => state.name,
}

export default new Vuex.Store({
  state,getters,actions,mutations
})
